package models;
import java.awt.event.WindowEvent;

import javax.swing.JFrame;
import javax.swing.JTextField;

import view.WormPanel;



public class WormChase extends JFrame {

	private static int DEFAULT_FPS = 80;
	private WormPanel wp;
	private JTextField jtfBox;
	private JTextField jtfTime;
	
	public WormChase(long period) {
		
	}

	/**
	 * enter arg to change fps
	 * @param args
	 */
	public static void main(String[] args) {
		int fps = DEFAULT_FPS;
		if(args.length != 0) {
			fps = Integer.parseInt(args[0]);
		}
		
		long period = (long) 1000.0/fps;
		System.out.println("fps: " + fps + "; period: " + period + " ms");
		
		new WormChase(period*1000000L);

	}
	
	
	
	private void makeGUI(long period) {
		
	}
	
	
	public void setBoxNumber(int num) { jtfBox.setText("Boxes used: " + num); }
	public void setTimeSpent(long t) { jtfTime.setText("Time Spend: " + t + " secs"); }
	
	public void windowActivated(WindowEvent e) { wp.resumeGame(); }
	public void windowDeactived(WindowEvent e) { wp.pauseGame(); }
	public void windowDeiconfied(WindowEvent e) { wp.resumeGame(); }
	public void windowIconified(WindowEvent e) { wp.pauseGame(); }
	public void windowClosing(WindowEvent e) { wp.stopGame(); } 

}
